package com.yonyou.cyxdms.sysAuth.service.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.yonyou.cyxdms.framework.bean.entity.base.DMSBasePO;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;
import com.yonyou.cyx.function.utils.bean.BeanMapperUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yonyou.cyx.framework.bean.dto.base.BaseDTO;

/**
 * <p>
 * 用户职位表
 * </p>
 *
 * @author 李贺
 * @since 2019-09-18
 */
@TableName("tr_user_org")
public class UserOrgPO extends DMSBasePO<UserOrgPO> {

    private static final long serialVersionUID = 1L;

        @TableId(value = "USER_ORG_ID", type = IdType.AUTO)
        private Long userOrgId;
    /**
     * 用户id
     */
    @TableField("USER_ID")
    private Long userId;
    @TableField("ORG_ID")
    private Long orgId;
    /**
     * 逻辑删除标志：是否删除
     */
    @TableField("IS_DELETED")
    @Version
    @TableLogic
    private Boolean isDeleted;
    @TableField("OWNER_CODE")
    private String ownerCode;

    @TableField("OWNER_ORG_TYPE")
    private Integer ownerOrgType;

    public UserOrgPO() {
        super();
    }

    public Integer getOwnerOrgType() {
        return ownerOrgType;
    }

    public void setOwnerOrgType(Integer ownerOrgType) {
        this.ownerOrgType = ownerOrgType;
    }

    public Long getUserOrgId() {
        return userOrgId;
    }

    public void setUserOrgId(Long userOrgId) {
        this.userOrgId = userOrgId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getOrgId() {
        return orgId;
    }

    public void setOrgId(Long orgId) {
        this.orgId = orgId;
    }

    public Boolean getDeleted() {
        return isDeleted;
    }

    public void setDeleted(Boolean isDeleted) {
        this.isDeleted = isDeleted;
    }

    public String getOwnerCode() {
        return ownerCode;
    }

    public void setOwnerCode(String ownerCode) {
        this.ownerCode = ownerCode;
    }

    @Override
    protected Serializable pkVal() {
        return this.userOrgId;
    }

    @Override
    public String toString() {
        return "UserOrgPO{" +
                "userOrgId=" + userOrgId +
                ", userId=" + userId +
                ", orgId=" + orgId +
                ", isDeleted=" + isDeleted +
                ", ownerCode='" + ownerCode + '\'' +
                ", ownerOrgType=" + ownerOrgType +
                '}';
    }


    /**
     * 将PO 信息转化为DTO
     *
     * @param dto 需要进行转换的dto
     * @author 李贺
     * @since 2018/7/22 0022
     */
    protected <T extends BaseDTO> void transDtoToPo(T dto) {
        BeanMapperUtil.copyProperties(this, dto, "userOrgId");
    }


}
